﻿namespace OverStore.Runtime.Logger
{
    using System;

    /// <summary>
    /// <see cref="ILogger"/> that does not output any information.
    /// </summary>
    public sealed class DummyLogger : ILogger
    {
        /// <summary>
        /// Singleton instance of <see cref="DummyLogger"/> class.
        /// </summary>
        public static readonly ILogger Value = new DummyLogger();

        /// <summary>
        /// Write information to log.
        /// </summary>
        /// <param name="caller">Object that calls Log method.</param>
        /// <param name="category">Message category string.</param>
        /// <param name="message">Information message formatting string.</param>
        /// <param name="arguments">Format arguments for <paramref name="message"/> string.</param>
        /// <remarks>
        /// Because String.Format is very resource-expensive method, avoid using it
        /// for create log message. Instead pass format template as message, and format arguments
        /// as arguments, and specific implementation calls string.Format internally if it is required.
        /// </remarks>
        public void Log(object caller, string category, string message, params object[] arguments)
        {
        }

        /// <summary>
        /// Write information to log.
        /// </summary>
        /// <param name="caller">Object that calls Log method.s</param>
        /// <param name="category">Message Category string.</param>
        /// <param name="messageBuilder">Function that returns log message.</param>
        /// <remarks>
        /// When message has complex structure that can't be expresses as formatting string,
        /// or message formatting is very resource-expensive, use the current overload of Log method.
        /// It specifies function that builds log message. If logger need to log message, it calls it, but if logging is off,
        /// this function never be called and performance don't be descreased.
        /// </remarks>
        public void Log(object caller, string category, Func<string> messageBuilder)
        {
        }
    }
}
